package guava;

import com.google.common.base.Charsets;
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;

public class MurMurHashTest {
	public static void main(String[] args) {
		test1();
		System.out.println("------");
		// test2();

	}

	private static void test2() {
		HashFunction hashFunction = Hashing.murmur3_32();
		System.out.println(hashFunction.newHasher().putString("com.tencent.mm", Charsets.UTF_8).hash().asInt());
		System.out.println(hashFunction.newHasher().putString("com.tencent.mm1", Charsets.UTF_8).hash().asInt());
	}

	private static void test1() {
		HashFunction hashFunction = Hashing.murmur3_32();
		HashCode hashcode = hashFunction.hashString("com.tencent.mm", Charsets.UTF_8);
		System.out.println(hashcode.asInt());
		System.out.println(hashcode);
	}
}
